﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SweeperPrototype.Business.Keys
{
    public class BookCode
    {
        
        private readonly string m_Value;
        public BookCode(string value)
        {
            m_Value = value;
        }

        public string Value
        {
            get { return m_Value; }
        }

        public override string ToString()
        {
            return m_Value;
        }

        public static bool operator ==(BookCode lhs, BookCode rhs)
        {
            if (ReferenceEquals(null, lhs)) return false;
            if (ReferenceEquals(null, rhs)) return false;

            return lhs.Value == rhs.Value;
        }

        public static bool operator !=(BookCode lhs, BookCode rhs)
        {
            return !(lhs == rhs);
        }

        public bool Equals(BookCode other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.m_Value, m_Value);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (BookCode)) return false;
            return Equals((BookCode) obj);
        }

        public override int GetHashCode()
        {
            return (m_Value != null ? m_Value.GetHashCode() : 0);
        }
    }
}
